package com.qianchen.chatbot.api.dto;

import java.util.ArrayList;

public class ResponsePageResult {
    private int code;
    private String message;
    private long timestamp;
    private Object data;
    private int currentPageNo;
    private boolean firstPage;
    private boolean lastPage;
    private int lastPageNo;
    private int nextPage;
    private int pageSize;
    private int prePage;
    private int totalCount;

    private ResponsePageResult(int code, String message) {
        this.setTimestamp(System.currentTimeMillis());
        this.code = code;
        this.message = message;
    }

    public static ResponsePageResult successInstance() {
        return new ResponsePageResult(0, StatusCodeConfig.getValue(String.valueOf(0)));
    }

    public static ResponsePageResult failInstance() {
        return new ResponsePageResult(-1, StatusCodeConfig.getValue(String.valueOf(-1)));
    }

    public static ResponsePageResult instance(int code) {
        return new ResponsePageResult(code, StatusCodeConfig.getValue(String.valueOf(code)));
    }

    public static ResponsePageResult empty(int currentPageNo, int pageSize) {
        return successInstance().setCurrentPageNo(currentPageNo).setPageSize(pageSize).setTotalCount(0).setData(new ArrayList());
    }

    public int getCode() {
        return this.code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public long getTimestamp() {
        return this.timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public Object getData() {
        return this.data;
    }

    public ResponsePageResult setData(Object data) {
        this.data = data;
        return this;
    }

    public int getCurrentPageNo() {
        return this.currentPageNo;
    }

    public ResponsePageResult setCurrentPageNo(int currentPageNo) {
        this.currentPageNo = currentPageNo;
        return this;
    }

    public boolean isFirstPage() {
        return this.firstPage;
    }

    public void setFirstPage(boolean firstPage) {
        this.firstPage = firstPage;
    }

    public boolean isLastPage() {
        return this.lastPage;
    }

    public void setLastPage(boolean lastPage) {
        this.lastPage = lastPage;
    }

    public int getLastPageNo() {
        return this.lastPageNo;
    }

    public void setLastPageNo(int lastPageNo) {
        this.lastPageNo = lastPageNo;
    }

    public int getNextPage() {
        return this.nextPage;
    }

    public void setNextPage(int nextPage) {
        this.nextPage = nextPage;
    }

    public int getPageSize() {
        return this.pageSize;
    }

    public ResponsePageResult setPageSize(int pageSize) {
        this.pageSize = pageSize;
        return this;
    }

    public int getPrePage() {
        return this.prePage;
    }

    public void setPrePage(int prePage) {
        this.prePage = prePage;
    }

    public int getTotalCount() {
        return this.totalCount;
    }

    public ResponsePageResult setTotalCount(int totalCount) {
        this.totalCount = totalCount;
        return this;
    }
}
